var connect_multiparty = require('connect-multiparty')({
    uploadDir: "F:\\tempfile",
    maxFieldsSize: 1024 * 1024 * 10
});
var typeis = require('type-is');
'use strict'
var maxSize = 1024 * 1024 * 10;//提交内容最大5M
var multiparty = function (req, res, next) {
    if (typeis(req, 'multipart/form-data')) {//是否为上传文件处理
        if (req.headers["content-length"] <= maxSize) {
            connect_multiparty(req, res, next);
        } else {
            var err = new Error("上传大小超出最大值");
            err.status = 413;
            next(err);
            return;
        }
    } else {
        next();
    }
}
module.exports = multiparty;